package com.jing.controller;

import com.jing.common.core.domain.R;
import com.jing.common.core.web.controller.BaseController;
import com.jing.common.core.web.page.TableDataInfo;
import com.jing.domain.Vo.PmsBrandVO;
import com.jing.service.PmsBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author：wp
 * @Package：com.jing.controller
 * @Project：jing
 * @name：PmsBrandController
 * @Date：2024/5/27 20:07
 */
@Api("品牌")
@RestController
@Slf4j
public class PmsBrandController extends BaseController {
    @Autowired
    private PmsBrandService pmsBrandService;

    @Autowired
    private HttpServletRequest request;

    @ApiOperation( "表" )
    @GetMapping("list")
    public R list(@RequestParam(required = false) String name){
        log.info ( "controller:路经：{}，请求方式：{}，传入参数是{},"
                ,request.getRequestURI (),request.getMethod (), name);
        List<PmsBrandVO> list1= pmsBrandService.list(name);
        return R.ok (list1);
    }

    @ApiOperation ("删除")
    @GetMapping("/del/{id}")
    public R del(@PathVariable Integer id){
        log.info ( "controller:路经：{}，请求方式：{}，传入参数是{}{},"
                ,request.getRequestURI (),request.getMethod (), id,null);
        pmsBrandService.del(id);
        return R.ok ();
    }


    @ApiOperation ( "添加" )
    @PostMapping("add")
    public R productcategoryadd(@RequestBody PmsBrandVO productAttributsVO ){
        log.info ( "==============参数是{}============",productAttributsVO);
        pmsBrandService.add(productAttributsVO);
        return R.ok ();
    }
    @ApiOperation ( "修改" )
    @PostMapping("updata")
    public R productcategoryupdate(@RequestBody PmsBrandVO pms){
        log.info ( "==============参数是{}============",pms);
        pmsBrandService.up(pms);
        return R.ok ();
    }



}
